package cn.iocoder.yudao.module.biz.dal.mysql.emergencyReservePlainDetail;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.biz.dal.dataobject.emergencyReservePlainDetail.BizEmergencyReservePlainDetailDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.biz.controller.admin.emergencyReservePlainDetail.vo.*;

/**
 * 预案详情 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface BizEmergencyReservePlainDetailMapper extends BaseMapperX<BizEmergencyReservePlainDetailDO> {

    default PageResult<BizEmergencyReservePlainDetailDO> selectPage(BizEmergencyReservePlainDetailPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<BizEmergencyReservePlainDetailDO>()
                .eqIfPresent(BizEmergencyReservePlainDetailDO::getReservePlainId, reqVO.getReservePlainId())
                .eqIfPresent(BizEmergencyReservePlainDetailDO::getStation, reqVO.getStation())
                .eqIfPresent(BizEmergencyReservePlainDetailDO::getDuty, reqVO.getDuty())
                .eqIfPresent(BizEmergencyReservePlainDetailDO::getWorkContent, reqVO.getWorkContent())
                .eqIfPresent(BizEmergencyReservePlainDetailDO::getPersonnel, reqVO.getPersonnel())
                .betweenIfPresent(BizEmergencyReservePlainDetailDO::getCreateTime, reqVO.getBeginCreateTime(), reqVO.getEndCreateTime())
                .eqIfPresent(BizEmergencyReservePlainDetailDO::getDeptId, reqVO.getDeptId())
                .orderByDesc(BizEmergencyReservePlainDetailDO::getId));
    }

    default List<BizEmergencyReservePlainDetailDO> selectList(BizEmergencyReservePlainDetailExportReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<BizEmergencyReservePlainDetailDO>()
                .eqIfPresent(BizEmergencyReservePlainDetailDO::getReservePlainId, reqVO.getReservePlainId())
                .eqIfPresent(BizEmergencyReservePlainDetailDO::getStation, reqVO.getStation())
                .eqIfPresent(BizEmergencyReservePlainDetailDO::getDuty, reqVO.getDuty())
                .eqIfPresent(BizEmergencyReservePlainDetailDO::getWorkContent, reqVO.getWorkContent())
                .eqIfPresent(BizEmergencyReservePlainDetailDO::getPersonnel, reqVO.getPersonnel())
                .betweenIfPresent(BizEmergencyReservePlainDetailDO::getCreateTime, reqVO.getBeginCreateTime(), reqVO.getEndCreateTime())
                .eqIfPresent(BizEmergencyReservePlainDetailDO::getDeptId, reqVO.getDeptId())
                .orderByDesc(BizEmergencyReservePlainDetailDO::getId));
    }

}
